package junit;


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;

import junit.framework.Assert;
import myExceptions.MyFileException;

import org.junit.Before;
import org.junit.Test;

import score.Score;
import score.Scorelist;

public class ScorelistTest {
	private Scorelist score;
	private BufferedReader buf;
	
	@Before
	public void init () {
		try {
			buf = new BufferedReader(new FileReader("puntajes.txt"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		
		try {
			score = new Scorelist(buf);
		} catch (MyFileException e) {
			e.printStackTrace();
		}
	}
	
	@Test
	public void testScore () {
		Score s1, s2, s3;
		s1 = new Score("juancito", 0, 23.0);
		s2 = new Score("pepito", 1, 80);
		s3 = new Score("silvio", 2, 20);
		//agrego nuevo puntaje y verifico que lo haya agregado
		score.getFacil().add(s1);
		score.getNormal().add(s2);
		score.getDificil().add(s3);
		Assert.assertTrue(score.getFacil().contains(s1));
		Assert.assertTrue(score.getNormal().contains(s2));
		Assert.assertTrue(score.getDificil().contains(s3));
		
	}
}
